Skip to content

use option LTO #271

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

use option LTO #271

wants to merge 1 commit into from

Conversation

Jason2866
Copy link
Contributor

the option LTO saves a lot of flash space (reducing firmware size).
The change is tested and working for use with pioarduino the changes for ArduinoIDE are done accordingly but not tested (not using ArduinoIDE).
More Info Discord discussion https://discord.com/channels/1263397951829708871/1263397951829708874/1332807939395686472

@me-no-dev The PR as suggested.

@Jason2866
Copy link
Contributor Author

Jason2866 commented Feb 4, 2025

Closing since compiling with LTO option is not possible with ArduinoIDE.
@me-no-dev Thx for testing!

@Jason2866 Jason2866 closed this Feb 4, 2025
@igrr
Copy link
Member

igrr commented Feb 4, 2025

Note that LTO is not compatible with linking rules which place certain object files into specific memory regions. For example, if IDF generates a linker script to place esp_timer.c.obj into IRAM, the rule may stop working after LTO gets enabled. This is the main reason why LTO is not enabled in IDF.

the option LTO saves a lot of flash space (reducing firmware size).

@Jason2866 could you please share some numbers, what size do you see with and without LTO in the tests you did?

@Jason2866
Copy link
Contributor Author

@igrr For project Tasmota we have a size decrease from about 100k when compiling for esp32 (firmware size is ~2M). Similar size decrease has EspEasy.

@Jason2866
Copy link
Contributor Author

Jason2866 commented Feb 4, 2025

Both projects had just minor small changes to do, to get it running with LTO.
Well imho the code creator is responsible for things you mentioned. Currently IDF just fails to compile itself when LTO is enabled. So there isn't a chance to hit the trap you showed ;-)

@Jason2866 Jason2866 deleted the patch-1 branch February 12, 2025 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants